package com.dingwen.treasure.kettle.controller;

import com.dingwen.treasure.kettle.base.annotation.ReSubmit;
import groovy.util.logging.Slf4j;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 　RefreshCacheController
 * 　@author dingwen
 * 　@date 2022/8/21
 */
@Api(tags = "缓存API")
@RestController
@Slf4j
@RequestMapping("cache")
public class CacheController {

    @ApiOperation(value = "刷新缓存")
    @GetMapping("/refresh")
    @CacheEvict(cacheNames = {"category","file"},allEntries = true)
    @ReSubmit(message = "操作过于频繁", isDeleteKey = false, time = 10)
    public void refresh() {
    }
}
